<template>
	<view class="couple-info">
		<view class="c-row-box">
			<view class="c-row-head">
				<view class="c-row-title">婚车信息</view>
				<view class="c-row-more" v-if="orderParams.news_type!=4"><icon type="cancel" size="22" color="#666" @click="cancelCarPresent"/></view>
			</view>
			<view class="c-row-item" v-for="(item,index) in carParams" :key="index" style="margin-bottom: 20px;">
				<view class="c-row c-row-list">
					<view class="c-row-col c-row-col-list-item">
						<view class="col-title"><text style="color: red;">*</text>执行公司</view>
						<view class="col-text">{{ dictionary.getPickerTitle('companyList', item.company_id)}}
						</view>
					</view>
				</view>
				<view class="c-row c-row-list">
					<view class="c-row-col c-row-col-list-item">
						<view class="col-title"><text style="color: red;">*</text>婚车类型</view>
						<view class="col-text">{{item.is_master == 1 ? '主车' : '跟车'}}
						</view>
					</view>
				</view>
				<view class="c-row c-row-list">
					<view class="c-row-col c-row-col-list-item">
						<view class="col-title"><text style="color: red;">*</text>婚车型号</view>
						<view class="col-text">
							{{dictionary.getPickerTitle('car', item.car_id)}}
						</view>
					</view>
				</view>
				<view class="c-row c-row-list">
					<view class="c-row-col c-row-col-list-item">
						<view class="col-title"><text style="color: red;">*</text>婚车数量</view>
						<view class="col-text">{{item.car_amount}}
						</view>
						<text style="font-size: 12px;">辆</text>
					</view>
				</view>
				<view class="c-row c-row-list">
					<view class="c-row-col c-row-col-list-item">
						<view class="col-title"><text style="color: red;">*</text>婚车费用</view>
						<view class="col-text">{{item.car_price}}
						</view>
					</view>
				</view>
				<view class="c-row c-row-list">
					<view class="c-row-col c-row-col-list-item">
						<view class="col-title"><text style="color: red;">*</text>服务时长</view>
						<view class="col-text">{{item.service_hour}}
						</view>
						<text style="font-size: 12px;">小时</text>
					</view>
				</view>
				<view class="c-row c-row-list">
					<view class="c-row-col c-row-col-list-item">
						<view class="col-title"><text style="color: red;">*</text>服务距离</view>
						<view class="col-text">{{item.service_distance}}
						</view>
						<text style="font-size: 12px;">公里</text>
					</view>
				</view>
				<view class="c-row c-row-list" v-if="item.car_remark">
					<view class="c-row-col c-row-col-list-item">
						<view class="col-title"><text style="margin-right: 10px;"> </text>备注</view>
						<view class="col-text">{{item.car_remark}}</view>
					</view>
				</view>
				<view class="delete">
                    <button class="c-button c-button-small c-button-primary" v-if="!isPreview" @click="delItem(index)">删除</button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import dictionary from '@/utils/dictionary.js';
	export default {
		props: {
			parent: {
				type: Object,
				default() {
					return {};
				}
			},
			orderParams: {
				type: Object,
				default () {
					return {}
				}
			},
			isPreview: {
				type: Boolean,
				default () {
					return false
				}
			},
			carParams: {
				type: Array,
				default () {
					return []
				}
			},
			companyList: {
				type: Array,
				default () {
					return []
				}
			},
		},
		data() {
			return {
              
			};
		},
		beforeMount() {
			this.dictionary = dictionary;
		},
		methods: {
			
			cancelCarPresent() {
				this.parent.carParams = [];
				this.parent.hasCarPresent = false;
			},
			// 选择型号
			chooseSearch(type){
				this.$emit('chooseSearch', type)
			},
			// 删除某一项
           delItem(index){
			   this.carParams.splice(index,1);
			   this.$emit('getOrderTotals');
		   }
		}
	}
</script>

<style lang="less">
	@import url('../../components/common.less');
	@import url('../common/common.less');
	.delete{
		margin-top: 5px;
		text-align: right;
	}
</style>
